$(function(){
    var initScreen=function(callback){//初始化html  font-size
        //$("html").css("font-size",document.documentElement.clientHeight/document.documentElement.clientWidth<1.5 ? (document.documentElement.clientHeight/603*312.5+"%") : (document.documentElement.clientWidth/375*312.5+"%")); //单屏全屏布局时使用,短屏下自动缩放
        $("html").css("font-size",document.documentElement.clientWidth/375*312.5+"%");//长页面时使用,不缩放
        if(callback)callback();
    }
    initScreen(function(){
        //屏幕改变重置
        window.addEventListener("orientationchange" in window ? "orientationchange" : "resize",function(e){
            var st=setTimeout(initScreen,300);
        }, false);
        var mySwiper = new Swiper ('.swiper-container-h1', {
                direction: 'horizontal',
                loop: true,
                // 如果需要分页器
                pagination: '.swiper-pagination',
                autoplay : 5000,
                autoplayDisableOnInteraction: false
            });
        var tabsSwiper = new Swiper('.swiper-container-h2',{
                speed:500,
                autoHeight: true,
                onSlideChangeStart: function(){
                  $(".tab div").removeClass('cur')
                  $(".tab div").eq(tabsSwiper.activeIndex).addClass('cur')  
                }
            });
            $(".tab div").on('touchstart mousedown',function(e){
                e.preventDefault()
                $(".tab div .cur").removeClass('cur')
                $(this).addClass('cur')
                tabsSwiper.slideTo( $(this).index() )
            })
            $(".tab div").click(function(e){
                e.preventDefault()
            })
        //点击分享按钮
        $(".repost").on('touchstart mousedown',function(e){
            $(".share-pop").show();
        });
        $(".share-pop-close").on('touchstart mousedown',function(e){
            $(".share-pop").hide();
        });
    });
})